import cv2

facer = cv2.CascadeClassifier("./haarcascades/haarcascade_frontalface_default.xml")
girl2 = cv2.imread("../asset/girl2.jpg")
girl = girl2.copy()
gray = cv2.cvtColor(girl2, cv2.COLOR_BGR2GRAY)

faces = facer.detectMultiScale(gray, 1.03, 3)
print(faces)
for (x, y, w, h) in faces:
    # cv2.rectangle(girl2, (x, y), (x + w, y + h), (0, 0, 255), 2)
    ROI_img = girl2[y:y + h, x:x + w]
    # result = cv2.GaussianBlur(ROI_img, (7, 7), 100)
    result = cv2.bilateralFilter(ROI_img, 9, 50, 50)
    girl2[y:y + h, x:x + w] = result
while True:
    cv2.imshow('girl2', girl2)
    cv2.imshow('girl', girl)
    key = cv2.waitKey(10)
    if key & 0xFF == ord('q'):
        break
cv2.destroyAllWindows()
